package main

import (
	"net/http"

	"github.com/gin-gonic/gin"

	hpb "gitee.com/jnshao/go-start/proto/tools/api"
	server "gitee.com/jnshao/go-start/proto/tools/gin_grpc"
)

func main() {
	helloSrv := server.NewHelloServer()
	engine := gin.Default()
	hpb.RegisterGreeterServerHTTPServer(helloSrv, engine)

	server := http.Server{
		Addr:    ":8080",
		Handler: engine,
	}
	//支持自动生成端口以及定义ip和端口
	_ = engine.SetTrustedProxies(nil)
	err := server.ListenAndServe()
	if err != nil && err != http.ErrServerClosed {
		panic(err)
	}
}
